#pragma once

#include "G3D/Vector3.h"
#include "movement/move_spline_flag.h"

using G3D::Vector3;

namespace Movement
{

    /**
         * @brief
         *
         */
    typedef std::vector<Vector3> PointsArray;

    /**
     * @brief
     *
     */
    union FacingInfo
    {
        /**
         * @brief
         *
         */
        struct
        {
            float x, y, z; /**< TODO */
        } f; /**< TODO */
        unsigned long long  target; /**< TODO */
        float   angle; /**< TODO */

        /**
         * @brief
         *
         * @param o
         */
        FacingInfo(float o) : angle(o) {}
        /**
         * @brief
         *
         * @param t
         */
        FacingInfo(unsigned long long t) : target(t) {}
        /**
         * @brief
         *
         */
        FacingInfo() {}
    };

    /**
     * @brief
     *
     */
    struct MoveSplineInitArgs
    {
        /**
         * @brief
         *
         * @param path_capacity
         */
        MoveSplineInitArgs(size_t path_capacity = 16) : path_Idx_offset(0),
            velocity(0.f), splineId(0)
        {
            path.reserve(path_capacity);
        }

        PointsArray path; /**< TODO */
        FacingInfo facing; /**< TODO */
        MoveSplineFlag flags; /**< TODO */
        int path_Idx_offset; /**< TODO */
        float velocity; /**< TODO */
        unsigned int splineId; /**< TODO */

        /**
         * @brief Returns true to show that the arguments were configured correctly and MoveSpline initialization will succeed.
         *
         * @param unit
         * @return bool
         */
        bool Validate(battle::object::Unit* unit) const;
    private:
        /**
         * @brief
         *
         * @return bool
         */
        bool _checkPathBounds() const;
    };

}
